#include <iostream>
#include <algorithm>
#include <iomanip>
#define MAX 1000
using namespace std;

typedef struct
{
    int bean;
    int money;
    double porp;
}room;

bool cmp(room i, room j)
{
    return (i.porp > j.porp);
}
int main()
{
    int m, n;
    room lis[MAX];
    while(cin >> m >> n && m!=-1 && n!=-1)
    {
        double buy = 0;
        for(int i=0; i<n; ++i)
        {
            cin >> lis[i].bean >> lis[i].money;
            lis[i].porp = (double)lis[i].bean/(double)lis[i].money;
        }
        sort(lis, lis+n, cmp);
        for(int i=0; i<n; ++i)
        {
            if(m > lis[i].money)
            {
                m -= lis[i].money;
                buy += lis[i].bean;
            }
            else
            {
                buy += m*lis[i].porp;
                break;
            }
        }
        cout << setiosflags(ios::fixed) <<setprecision(3) << buy << endl;
    }

    return 0;
}
/*
5 3
7 2
4 3
5 2
20 3
25 18
24 15
15 10
-1 -1

13.333
31.500
*/
